package com.example.tlias.service.impl;

import com.example.tlias.mapper.DeptMapper;
import com.example.tlias.pojo.Dept;
import com.example.tlias.service.DeptServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptServiceI {

    @Autowired
    private DeptMapper demtMapper;

    @Override
    public List<Dept> list() {
        return demtMapper.list();
    }

    @Override
    public void deleteid(Integer id) {
        demtMapper.deleteid(id);
    }

    @Override
    public void add(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());

        demtMapper.insert(dept);
    }

    @Override
    public Dept select(Integer id) {
        return demtMapper.select(id);
    }

    @Override
    public void update(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        demtMapper.update(dept);
    }


}
